<?php

class SsqDataModel
{
    protected $dataRoot = '';
    public function __construct()
    {
        $this->dataRoot = dirname(__DIR__) . '/data/ssq/';
        if (!file_exists($this->dataRoot)) {
            mkdir($this->dataRoot, 0777, true);
        }
    }

    public function datasource()
    {
        $filename = $this->dataRoot . 'data-all.json';
        if (!file_exists($filename)) {
            return message(null, '数据不存在', 500);
        }
        return message(json_decode(file_get_contents($filename), true));
    }
}
